package leetcode.jianzhioffer;

/**
 * @program: datastructureandalogorithm
 * @description:
 * @author: hmx
 * @create: 2021-10-28 16:43
 **/
public class JianZhiOffer32II {

    /*public List<List<Integer>> levelOrder(TreeNode root) {
        List<List<Integer>> list = new ArrayList<>();
        if (root == null) {
            return list;
        }
        Deque<TreeNode> deque = new LinkedList<>();
        deque.offer(root);
        //存储每层的元素
        List<Integer> temp = null;
        //存储临时节点
        TreeNode node = null;
        while (!deque.isEmpty()) {
            //记录当前层元素个数
            int size = deque.size();
            temp = new ArrayList();
            for (int i = 0; i < size; i++) {
                node = deque.poll();
                temp.add(node.val);
                if (node.left != null) {
                    deque.offer(node.left);
                }
                if (node.right != null) {
                    deque.offer(node.right);
                }
            }
            list.add(temp);
        }
        return list;
    }*/

}
